﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Fjaspx.UI.Web.configuration.system
{
    public partial class batchSelectArea_ajax : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Response.CacheControl = "no-cache";
                Response.Expires = 0;
                newsList.InnerHtml = newsstr();
            }
        }

        string newsstr()
        {
            string ParentId = Request.QueryString["ParentId"];
            if (ParentId == "" || ParentId == null)
            {
                ParentId = "0";
            }
            else
            {
                ParentId = ParentId.ToString();
            }
            string liststr = string.Empty;

            List<Fjaspx.Sys.Model.Fjaspx_Provinces> data = new Fjaspx.Sys.Bll.Fjaspx_Provinces().GetListByColumn(int.Parse(ParentId));

            foreach (Fjaspx.Sys.Model.Fjaspx_Provinces da in data)
            {
                List<Fjaspx.Sys.Model.Fjaspx_Provinces> datas = new Fjaspx.Sys.Bll.Fjaspx_Provinces().GetListByColumn(da.ID);

                if (datas.Count > 0)
                {
                    liststr += "<div><img src=\"../../Admin/images/b.gif\" alt=\"点击展开子栏目\"  border=\"0\" class=\"LableItem\" onClick=\"javascript:SwitchImg(this,'" + da.ID + "');\" />&nbsp;<span id=\"" + da.ID + "\" class=\"LableItem\" ondblclick=\"ReturnValue();\" onClick=\"SelectLable(this);sFiles('" + da.ID + "','" + da.Province_city + "');\">" + da.Province_city + "</span><div id=\"Parent" + da.ID + "\" class=\"SubItem\" HasSub=\"True\" style=\"height:100%;display:none;\"></div></div>";
                }
                else
                {
                    liststr += "<div><img src=\"../../Admin/images/s.gif\" alt=\"没有子栏目\"  border=\"0\" class=\"LableItem\" />&nbsp;<span id=\"" + da.ID + "\" class=\"LableItem\" ondblclick=\"ReturnValue();\" onClick=\"SelectLable(this);sFiles('" + da.ID + "','" + da.Province_city + "');\">" + da.Province_city + "</span></div>";
                }
            }
            if (liststr != string.Empty)
                liststr = "Succee|||" + ParentId + "|||" + liststr;
            else
                liststr = "Fail|||" + ParentId + "|||";
            return liststr;
        }
    }
}